package cn.itcast.web.action;

import cn.itcast.domain.transit.DeliveryInfo;
import cn.itcast.service.DeliveryService;
import cn.itcast.web.action.common.BaseAction;
import org.apache.struts2.convention.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Namespace("/")
@ParentPackage("json-default")
@Controller
@Scope("prototype")
@Actions
public class DeliveryAction extends BaseAction<DeliveryInfo> {
    @Autowired
    private DeliveryService deliveryService;
    private String transitInfoId;

    public void setTransitInfoId(String transitInfoId) {
        this.transitInfoId = transitInfoId;
    }
    //     action="../../delivery_save.action">
    @Action(value = "delivery_save",results = {
            @Result(name = "success",location = "pages/transit/transitinfo.html",type = "redirect")})
    public String save(){

        deliveryService.save(transitInfoId,model);
        return SUCCESS;
    }
}
